<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <script src="<%=request.getContextPath()%>/js/jquery-3.3.1.min.js"></script>

    <script>
        $(function(){

            $("a").click(function(){
                <%--$("#image").prop("src","<%=request.getContextPath()%>/show.code?a="+Math.random());--%>
                $("#image").prop("src","<%=request.getContextPath()%>/show.code?a="+new Date().getTime());
            });

        });
    </script>

</head>
<body>
    <form action="<%=request.getContextPath()%>/submit.code" method="post">

        <a href="javascript:;">
            <img id="image" src="<%=request.getContextPath()%>/show.code"/>
        </a>

        <a href="javascript:;">换一张</a>

        <input type="text" name="code" size="5"/><br/>
        <input type="submit" value="提交"/>
    </form>

    <%
        String message= (String) request.getAttribute("message");
        if(message!=null){
            out.print(message);
        }
    %>

</body>
</html>
